﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class UIView : MonoBehaviour {

    private Transform _firstChoosePanel;
    private Transform _secondChoosePanel;
    private Toggle _firstChooseToggle;
    private Toggle _secondChooseToggle;

    void Awake()
    {
        Init();
    }

    private void Init()
    {
        _firstChoosePanel = transform.GetChild(1);
        _secondChoosePanel = transform.GetChild(2);
        _firstChooseToggle = transform.GetChild(0).GetChild(0).GetComponent<Toggle>();
        //_firstChooseToggle.onValueChanged.AddListener(
        //    delegate { _firstChoosePanel.gameObject.SetActive(_firstChooseToggle.isOn); }
        //    );
        _firstChooseToggle.onValueChanged.AddListener((bool changeValue) => { _firstChoosePanel.gameObject.SetActive(changeValue); });
        _secondChooseToggle = transform.GetChild(0).GetChild(1).GetComponent<Toggle>();
        _secondChooseToggle.onValueChanged.AddListener(
             delegate { _secondChoosePanel.gameObject.SetActive(_secondChooseToggle.isOn); }
             );
    }
}
